const ECharts = require('echarts/lib/echarts');
export const optionConfig = (dataX,dataYL,dataYB) => {
    return {
        tooltip: {
            trigger: 'axis',
            axisPointer: { // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            },
            formatter: function(list) {
                let msg = "";
                for (let i in list) {
                    if (i == 0) {
                        msg += list[i].name + "<br>";
                    }
                    msg += list[i].seriesName + "：" + list[i].data + "min<br>";
                }
                return msg;
            }
        },
        legend: {
            top:'3%',
            textStyle: {
                color: '#fff',
                fontSize: 10
            },
            data: ['当月量', '累计量']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            top: '25%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            axisLine: {
                show: false,
                lineStyle: {
                    color: '#808eb7',
                    width: 2
                }
            },
            axisTick: {
                show: false,
            },
            data: dataX,
        },
        yAxis: {
            name: '单位/个小时',
            nameTextStyle: {
                color: '#FFF',
                fontSize: 10
            },
            axisLine: { // y轴
                show: false,
                lineStyle: {
                    color: '#808eb7',
                    width: 2
                }
            },
            splitLine: { //y轴分割线配置
                show: false,
                lineStyle: {
                    color: "#AAAAAA56",
                }
            },
            axisTick: {
                show: false,
            },
        },
        series: [{
            name: '当月量',
            type: 'bar',
            stack: '余额',
            barMaxWidth: 32,
            data: dataYB,
            itemStyle: {
                normal: {
                    color: new ECharts.graphic.LinearGradient(0, 1, 0, 0, [{
                        offset: 1,
                        color: "#00ffff" // 0% 处的颜色
                    },
                        {
                            offset: 0,
                            color: "#3893e5" // 100% 处的颜色
                        }
                    ], false),
                },
            },
        },
            {
                name: '累计量',
                data: dataYL,
                type: 'line',
                symbol: 'circle',
                symbolSize: 13,
                itemStyle: {
                    normal: {
                        color: "#0088D4",
                    },
                },
            }
        ]
    };
}
